# -*- coding: utf-8 -*-
"""The admin module."""
from flask import session,Blueprint
from main.admin.models import SystenConfig


bp = Blueprint('admin', __name__, url_prefix='/admin')


@bp.before_request
def before_request():
    if not session.get('system_config'):
        sc = SystenConfig.query.first()
        sc_json = {
            'name':sc.name,
            'title':sc.title,
            'enable':sc.enable,
            'enable_msg':sc.enable_msg,
            'blank_name':sc.blank_name,
            'minwith':sc.minwith,
            'withwas':sc.withwas,
            'withtax':sc.withtax,
            'mintransfer':sc.mintransfer,
            'max_buy_product':sc.max_buy_product,
            'default_send_product':sc.default_send_product
        }
        session['system_config'] = sc_json



from . import views, models, api  # noqa
